package com.atguigu.oss.utils;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author ran
 * @creat
 */
//@Component
public class ConstantPropertiesUtils implements InitializingBean {

//    @Value("aliyun.oss.file.endpoint")
    private String endpoint = "oss-cn-beijing.aliyuncs.com";

//    @Value("aliyun.oss.file.keyid")
    private String keyId = "LTAI5tRe5fKRNcaLPr5SWz9q";

//    @Value("${aliyun.oss.file.keysecret}")
    private String keySecret = "GgyObc0tK8pNvpSwPG6pCusOrNkuxB";

//    @Value("${aliyun.oss.file.bucketname}")
    private String bucketName = "guli-99";

    //定义公开静态常量
    public static String END_POIND;
    public static String ACCESS_KEY_ID;
    public static String ACCESS_KEY_SECRET;
    public static String BUCKET_NAME;

    @Override//在spring加载后执行这个方法
    public void afterPropertiesSet() throws Exception {
        END_POIND = endpoint;
        ACCESS_KEY_ID = keyId;
        ACCESS_KEY_SECRET = keySecret;
        BUCKET_NAME = bucketName;
    }
}
